// Copyright (C) 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// This file was originally generated by codergen, but has now been locked
// to prevent cyclic reference in the build system

package interval

import (
	"github.com/google/gapid/core/data/id"
	"github.com/google/gapid/core/data/pod"
	"github.com/google/gapid/framework/binary"
	"github.com/google/gapid/framework/binary/registry"
)

// Make sure schema init() runs first
import _ "github.com/google/gapid/framework/binary/schema"

// force use the id package, because our imports handling is wrong
var _ id.ID

const (
	ixǁU64Range = iota
)

var entities [1]binary.Entity

var Namespace = registry.NewNamespace()

func init() {
	registry.Global.AddFallbacks(Namespace)
	Namespace.AddClassOf((*U64Range)(nil))
}

type binaryClassU64Range struct{}

func (*U64Range) Class() binary.Class {
	return (*binaryClassU64Range)(nil)
}
func doEncodeU64Range(e pod.Writer, o *U64Range) {
	e.Uint64(o.First)
	e.Uint64(o.Count)
}
func doDecodeU64Range(d pod.Reader, o *U64Range) {
	o.First = uint64(d.Uint64())
	o.Count = uint64(d.Uint64())
}
func doDecodeRawU64Range(d pod.Reader, o *U64Range) {
	o.First = uint64(d.Uint64())
	o.Count = uint64(d.Uint64())
}
func (*binaryClassU64Range) Encode(e binary.Encoder, obj binary.Object) {
	doEncodeU64Range(e, obj.(*U64Range))
}
func (*binaryClassU64Range) New() binary.Object {
	return &U64Range{}
}
func (*binaryClassU64Range) DecodeTo(d binary.Decoder, obj binary.Object) {
	doDecodeU64Range(d, obj.(*U64Range))
}
func (o *U64Range) WriteSimple(w pod.Writer) {
	doEncodeU64Range(w, o)
}
func (o *U64Range) ReadSimple(r pod.Reader) {
	doDecodeU64Range(r, o)
}
func (c *binaryClassU64Range) Schema() *binary.Entity {
	return &entities[ixǁU64Range]
}
